package com.ht.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ht.entity.ColumnsEntity;
import com.ht.mapper.ColumnsMapper;
import com.ht.service.IColumnsService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author ht
 */
@Service("columnsService")
public class ColumnsServiceImpl extends ServiceImpl<ColumnsMapper, ColumnsEntity> implements IColumnsService {
    @Override
    public IPage<ColumnsEntity> queryPage(Page<ColumnsEntity> tablesEntityPage, String tableName) {
        List<ColumnsEntity> columnsEntities = this.baseMapper.selectMaps(tableName);
        int count = this.count();
        tablesEntityPage.setTotal(count);
        tablesEntityPage.setRecords(columnsEntities);
        return tablesEntityPage;
  }
    @Override
    public List<ColumnsEntity> queryColumns(String tableName) {
        return baseMapper.selectMaps(tableName);
    }
}